package com.tang.generate.controller

import com.tang.framework.core.controller.BaseController
import com.tang.framework.core.domain.HttpResult
import com.tang.common.model.req.ReqId
import com.tang.generate.model.req.TableAddReq
import com.tang.generate.service.ITableService

import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag

import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import jakarta.annotation.Resource

@Tag(name = "新增表")
@RestController
@RequestMapping("/table")
class TableController : BaseController() {

    @Resource
    private lateinit var tableService: ITableService;


    @Operation(summary = "新增数据库表")
    @PostMapping("/add")
    fun addTable(@RequestBody tableAddReq: TableAddReq): HttpResult<String> = tableService.add(tableAddReq);


    @Operation(summary = "更新")
    @PostMapping("/update")
    fun updateTable(@RequestBody tableAddReq: TableAddReq): HttpResult<String> = tableService.update(tableAddReq);

    @Operation(summary = "获取表信息")
    @PostMapping("/getTableInfo")
    fun getTableInfo(@RequestBody reqId: ReqId): HttpResult<TableAddReq> = tableService.getTableInfo(reqId);


}
